package thread;

public class Demo11 {
    public static void main(String[] args) throws InterruptedException {
        Thread mainThread = Thread.currentThread();
        Thread t1 = new Thread(() -> {
            try {
                mainThread.join() ;
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println("main线程结束");
        });
        t1.start();
        System.out.println("等待main线程结束");
        Thread.sleep(3000);
    }
}
